From: David Vrabel Date: Fri, 15 Nov 2013 10:00:46 +0000 (+0100) Subject: kexec: fail image loads if the page tables cannot be built X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~5954 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=317ac0adf7f76a999c8af09f66beb625bbc02e32;p=xen.git kexec: fail image loads if the page tables cannot be built CID 1128566 If an image source page is allocated in kimage_alloc_page() but the machine_kexec_add_page() fails, the image may appear to load succesfully but it will not execute. The relocation will fault (rebooting the host) when trying to copy the source page, as it is not mapped. Signed-off-by: David Vrabel Reviewed-by: Andrew Cooper --- diff --git a/xen/common/kimage.c b/xen/common/kimage.c index 5c3e3b371f..91943f175a 100644 --- a/xen/common/kimage.c +++ b/xen/common/kimage.c @@ -592,6 +592,7 @@ static struct page_info *kimage_alloc_page(struct kexec_image *image, */ struct page_info *page; paddr_t addr; + int ret; /* * Walk through the list of destination pages, and see if I have a @@ -656,7 +657,13 @@ static struct page_info *kimage_alloc_page(struct kexec_image *image, } } found: - machine_kexec_add_page(image, page_to_maddr(page), page_to_maddr(page)); + ret = machine_kexec_add_page(image, page_to_maddr(page), + page_to_maddr(page)); + if ( ret < 0 ) + { + free_domheap_page(page); + return NULL; + } return page; }